Skip to content

Conversation

@brettz9
Copy link

@brettz9 brettz9 commented Nov 5, 2025

PR Checklist

Overview

Adds an ESM export file for use in the browser.

The other non-underscored (private) keys I saw on the global mocha object which I wasn't sure which I might include were the following:

files, options, suite, isWorker, throwError, ui

@mark-wiemer
Copy link
Member

For now let's exclude the private keys, they shouldn't be necessary for this export.

@mark-wiemer mark-wiemer self-assigned this Nov 8, 2025
@codecov
Copy link

codecov bot commented Nov 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.69%. Comparing base (2a0bce0) to head (b86a907).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5527   +/-   ##
=======================================
  Coverage   93.69%   93.69%           
=======================================
  Files          57       57           
  Lines        4391     4391           
  Branches      850      850           
=======================================
  Hits         4114     4114           
  Misses        277      277           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@brettz9
Copy link
Author

brettz9 commented Nov 8, 2025

Thank you for the review!

I saw the linting failed after the merge, so I added my addition of /mocha.mjs to the eslint config file. There's also still a failure with /esm/mocha.js, a file that predated this PR, but with that file not being published, I wasn't sure what that was about. It technically is not even allowed with the ".js" extension since the package.json is type: 'commonjs'. Don't know if that file should be converted to .mjs, removed, treated as ESM by the linter anyways, or what?

@mark-wiemer
Copy link
Member

Fixed the build error, but not sure how to manually test this one. Going to unassign myself as this isn't a focus area for me compared to bugfixes and the v12 release, but hopefully after v12 we can come back to this. Thanks for getting this started and continuing to follow up!

@mark-wiemer mark-wiemer removed their assignment Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🚀 Feature: Ability to import mocha from ESM in the browser

2 participants